<?php 
	require_once '../../config.php';
	if(!isset($_SESSION['login']) || $_SESSION['login']!=true){
		header('location:'.$URL_INCLUDES.'/Logueo.php');
		exit();
	}
	include_once $RUTA_INCLUDES.'/Head.php';
	include_once $RUTA_INCLUDES.'/Menu.php';
	
	$inst=new Instalaciones();
	$stock = $inst->getElementosStock();
?>
<!--AQUI EMPIEZO YO -->
        <div id="containerHolder">
			<div id="container">
        		<div id="sidebar">
                	<ul class="sideNav">
                    	<li><a href="Aport_Comer.php">Commercial Contribution</a></li>
                    	<li><a href="Ultimos_mov.php" >Last Movements</a></li>
                    	<li><a href="Stock.php" class="active">Stock</a></li>
                    </ul>
                    <!-- // FIN .sideNav -->
                </div>    
                <!-- // FIN #sidebar -->
                
                <!-- h2 stays for breadcrumbs -->
                <h2 id="titulos">
                	<a>Consignation</a> &raquo; 
                	<a class="active">Stock</a>
                </h2>
                <div id="main">
					<h3>Stock</h3>
                    	<table class="tablaStock">
                    		<tr >
                    			<th>CODE</th>
                    			<th>ITEM</th>
                    			<th>QUANT.</th>
                    			<th>SERIE</th>
                    		</tr>
                    		<?php
							for($t=0; $t<count($stock) ;$t++){
								$elemento=$stock[$t];
								$numSerie=$elemento['Item No_'];
								$name=$inst->getNombreItem($elemento['Item No_']);
								$total=ROUND($inst->getCantidadItem($elemento['Item No_']),2);
							?>
								<tr>
 									<td><?php echo $numSerie; ?></td>
 									<td class="nombreStock"><?php echo $name;?></td>
 									<td><?php echo $total; ?></td>
 									<td class="action">
 										<a href="Stock_NumSerie.php?numSerie=<?php echo $numSerie;?>&name=<?php echo $name;?>&total=<?php echo $total;?>" class="edit">Show Serial N</a>
 									</td>
							   	</tr>
							<?php
							}
							?>
                        </table>
                        <p class="totalLineas">Lines <?php echo $t;?></p>
                        <input id="irInsertarMaquina" type="submit" value="Insert Machine" class="botoncito boton_otro">
                        <a href="../../fpdf/printStock.php" target="_blank"><input type="submit" value="Print" class="botoncito boton_otro" id="btImpri"></a>
                    <h3></h3>
                </div>
                <!-- // #main -->
                
                <div class="clear"></div>
            </div>
            <!-- // #container -->
        </div>	
        <!-- // #containerHolder -->
        <!--AQUI TERMINO YO-->
<?php 
	include_once $RUTA_INCLUDES.'/Pie_pagina.php';
?>